//
// Created by de on 3/25/21.
//

#ifndef FORCEEIGENTEST_STATEFACTORY_H
#define FORCEEIGENTEST_STATEFACTORY_H

#include "State/Basic/PlaformStateAbstract.h"
#include "State/TInitState.h"
#include "State/Exception/PlaformFactoryException.h"
#include "State/TPrepareState.h"

#include "State/TRunningState.h"
#include "State/TErrorState.h"


/**
 * factory create the state
 */
class StateFactory{
public:
    static PlaformStateAbstract* create(StateStatus state,StateSelection* p_StateSelection){

        switch (state){
            case InitState:
                p_static_StateAbstract = new TInitState(p_StateSelection);
                break;

            case PrepareState:
                p_static_StateAbstract = new TPrepareState(p_StateSelection);
                break;

            case RunningState:
                p_static_StateAbstract = new TRunningState(p_StateSelection);
                break;
            case ErrorState:
                p_static_StateAbstract = new TErrorState(p_StateSelection);
                break;
            default:
                throw  PlaformFactoryException("not this type ");
                break;
        }
        return p_static_StateAbstract;

    }

private:
    static  PlaformStateAbstract * p_static_StateAbstract;
};

#endif //FORCEEIGENTEST_STATEFACTORY_H
